package main;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.zip.GZIPInputStream;

public class AtencionAlCliente extends Thread {
	private Socket cli;	
	private GZIPInputStream gzipin;
	private DataInputStream in;
	
	public AtencionAlCliente(Socket socket_cliente, Object object) {
		super("AtencionAlCliente");
		cli = socket_cliente;
	}
	
	public void run() {		
		CodifMsjaCAP cod;
		byte[] msj;
		Mensaje_al_CAP  mdc;
		
		try {
		
			gzipin = new GZIPInputStream(cli.getInputStream());

			in  = new DataInputStream(gzipin);
			cod = new CodifMsjaCAP();	
			mdc = null;
		
			msj = cod.desenmarcar(in);
			mdc = cod.delCable(msj);
		
			System.out.print(mdc.getEnfermero().getDNI());
		
			DataOutputStream out = new DataOutputStream(cli.getOutputStream());
		
			out.writeInt(555);
			out.close();
			in.close();
			cli.close();
		
		} catch (IOException e) { e.printStackTrace(); } // Fin catch
	
	}
	
}
